<script setup lang="js">
import { defineAsyncComponent } from "vue";
import {
  darkTheme,
  NConfigProvider,
  // NThemeEditor,
  NDialogProvider,
  NMessageProvider
} from "naive-ui";
// naive-ui 自定义样式
import $NaiveUiTheme from "@/utils/naive-ui-theme";
import { throttle, remInit } from "@/utils"
const dialogBase = defineAsyncComponent(() => import("@/components/base/dialog/dialog.vue"));
const uploadComponent = defineAsyncComponent(() => import("@/utils/upload/upload.vue"));

// rem 初始化
remInit();
window.onresize = throttle(() => { remInit() });

</script>

<template>
  <n-config-provider :theme="darkTheme" :theme-overrides="$NaiveUiTheme.themeOverrides">
    <n-message-provider>
      <n-dialog-provider>
        <router-view />
        <!-- 全局自定义dialog -->
        <dialog-base />
        <upload-component />
      </n-dialog-provider>
    </n-message-provider>
    <!-- UI配置编辑器 -->
    <!-- <n-Theme-editor /> -->
  </n-config-provider>
</template>

<style lang="scss" scoped></style>
